const on = 'ON';

chrome.action.onClicked.addListener(async (tab) => {
    let text = await chrome.action.getBadgeText({ tabId: tab.id });

    if (text === on) {
        text = ''
    } else {
        text = on;
    }

    chrome.action.setBadgeText({ tabId: tab.id, text: text });
});
